{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9c0092bd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "stu_id: [10001, 10002, 10003, 10004, 10008, 10001, 10009, 10010, 10001] \n",
      " stu_id_matedata: [10001, 10002, 10003, 10004, 10008, 10001, 10009, 10010, 10001]\n",
      "stu_id: [10001, 10003, 10004, 10008, 10001, 10009, 10010, 10001] \n",
      " stu_id_matedata: [10001, 10002, 10003, 10004, 10008, 10001, 10009, 10010, 10001]\n"
     ]
    }
   ],
   "source": [
    "# Author: Jinkai\n",
    "# Date: week 06\n",
    "\n",
    "stu_id = [10001,10002,10003,10004,10008,10001,10009,10010,10001]\n",
    "\n",
    "# 1. copy()很重要\n",
    "# 思考，赋值是真正的复制么？ 赋值(=) <=> copy? 不等价\n",
    "stu_id_matedata = stu_id\n",
    "print(\"stu_id:\",stu_id,'\\n','stu_id_matedata:',stu_id_matedata)\n",
    "\n",
    "# 实验 1 赋值\n",
    "# stu_id.pop(1)\n",
    "# print(\"stu_id:\",stu_id,'\\n','stu_id_matedata:',stu_id_matedata)\n",
    "\n",
    "# 实验2 copy()\n",
    "# stu_id_matedata = stu_id.copy()\n",
    "# stu_id.pop(1)\n",
    "# print(\"stu_id:\",stu_id,'\\n','stu_id_matedata:',stu_id_matedata)\n",
    "\n",
    "# 实验3 切片实现复制\n",
    "stu_id_matedata = stu_id[:]\n",
    "stu_id.pop(1)\n",
    "print(\"stu_id:\",stu_id,'\\n','stu_id_matedata:',stu_id_matedata)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5094be05",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
